package com.github.freewu.mvp.presenter;


import android.content.Intent;
import android.content.res.AssetManager;
import android.util.Log;

import com.github.freewu.commons.http.HttpCallBack;
import com.github.freewu.commons.http.HttpUtils;
import com.github.freewu.mvp.bean.ViewLife;
import com.github.freewu.mvp.mvpInterface.MvpInterface;
import com.github.freewu.script.ScriptContext;
import com.github.freewu.script.js.JSRuntime;

import java.io.IOException;

import okhttp3.Call;
import okio.BufferedSource;
import okio.Okio;


/**
 * 控制器
 * Created by free on 2016/5/10 0010.
 */
public abstract class Presenter<V extends MvpInterface.ViewInterface>{
    public final String TAG=this.getClass().getSimpleName();

    protected V mView;

    protected int viewLife;

    public Presenter(V mView){
        this.mView=mView;

        init(getView().getIntent());
    }

    public V getView(){
        return mView;
    }

    public abstract void init(Intent intent);

    public void onCreate(){
        this.viewLife= ViewLife.ONCREATE;
    }
    public void onPause(){
        this.viewLife= ViewLife.ONPAUSE;
    }
    public void onDestroy(){
        this.viewLife= ViewLife.ONDESTORY;
    }
    public void onCreateView(){
        this.viewLife= ViewLife.ONCREATEVIEW;
    }
}
